﻿


using SvCore.CallOut;

Console.WriteLine("Hello, World!");
Console.WriteLine(Directory.GetCurrentDirectory());

// 解析命令行参数
Core.ParseArgs(args);

// 读取配置
Conf.InitConfSystem();
Conf.InitConf();

Core.InitLog();

// 连接到Redis
if (!SvRds.Start()) { Console.ReadKey(); return; }

// 数据加载
if (!CacheGame.Load()) { Console.ReadKey(); return; }

{
    var sv = new SvCmd();
    sv.AddController(sv);
    sv.AddController(new GameCmds());
    Core.AddSv(sv);
}

{
    var sv = new SvSchedule();
    sv.BindGame();
    Core.AddSv(sv);
}

{
    var sv = new SvCallOut();
    Core.AddSv(sv);
}

{
    var sv = new SvTcp();
    sv.Port = SvInfo.ServerPort;
    sv.OnConnected = GameTcp.OnConnected;
    sv.OnClosed = GameTcp.OnClosed;
    sv.AddController(new GameHandler());
    Core.AddSv(sv);
}

{
    Core.AddExit(new GameCmds());
}

Core.Start();
